﻿<phone:PanoramaItem x:Class="PhoneGuitarTab.UI.Views.PanaromaItems.Tabs"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:Command="clr-namespace:PhoneCore.Framework.Views.Commands;assembly=PhoneGuitarTab.Core"
                    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
                    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
                    xmlns:Infrastructure="clr-namespace:PhoneGuitarTab.UI.Infrastructure"
                    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                    xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
                    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                    DataContext="{Binding Collection, Source={StaticResource Locator}}"
                    Header="{Binding Path=LocalizedResources.Panarama_Tabs, Source={StaticResource LocalizedStrings}}"
                    mc:Ignorable="d">
    <phone:PanoramaItem.Resources>
        <Infrastructure:TabsGroupsCollectionToVisibilityConverter x:Key="tabsGroupsCollectionToVisibility" />
    </phone:PanoramaItem.Resources>
    <Grid>
        <toolkit:LongListMultiSelector x:Name="TabList" Margin="{Binding Startup.ListMargin, Source={StaticResource Locator}}"
                              toolkit:TiltEffect.IsTiltEnabled="True"
                              Background="Transparent" IsGroupingEnabled="true" HideEmptyGroups ="true"
                              GroupHeaderTemplate="{StaticResource GroupHeaderTemplate}"
                              JumpListStyle="{StaticResource SearchListJumpListStyle}"
                              ItemTemplate="{StaticResource TabItemDataTemplate}"
                              IsSelectionEnabled="{Binding IsSelectionEnabled}"
                              EnforceIsSelectionEnabled="{Binding IsSelectionEnabled}"
                              ItemsSource="{Binding AllTabs, Mode=TwoWay}" IsSelectionEnabledChanged="TabList_IsSelectionEnabledChanged" >
            <i:Interaction.Triggers>
                <i:EventTrigger EventName="SelectionChanged">
                    <Command:ExecuteCommandAction Command="{Binding SetSelectedItems}" CommandParameter="{Binding ElementName=TabList}" />
                </i:EventTrigger>
            </i:Interaction.Triggers>
            <toolkit:LongListMultiSelector.ListHeaderTemplate>
                <DataTemplate>
                    <TextBlock Margin="0,80"
                           HorizontalAlignment="Center"
                           FontSize="24"
                           Opacity="0.5"
                           Text="{Binding Path=LocalizedResources.PanaramaTabs_NoTabs, Source={StaticResource LocalizedStrings}}"
                           Visibility="{Binding DataContext.AllTabs,
                                                ElementName=TabList,
                                                Converter={StaticResource tabsGroupsCollectionToVisibility}}" />
                </DataTemplate>
            </toolkit:LongListMultiSelector.ListHeaderTemplate>
        </toolkit:LongListMultiSelector>
    </Grid>
   
</phone:PanoramaItem>